from django.http import HttpResponse
from django.shortcuts import redirect,reverse

def index(request):
    #?username=xxx
    username = request.GET.get('username')
    if username:
        return HttpResponse("CMS后台首页")
    else:
        # login_url =  reverse('cms:login')
        # print('=' * 50)
        # print(login_url)
        # print('=' * 50)
        # return redirect(login_url)
        current_app = request.resolver_match.namespace
        return redirect(reverse("%s:login"% current_app))

def login(request):
    return HttpResponse("CMS登录页面")

